package org.come.xinyuan;

import com.tool.tcpimg.UIUtils;
import org.come.until.FormsManagement;
import org.come.until.Music;

import javax.swing.*;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

public class SkillMainFrame5 extends JInternalFrame implements MouseListener {
    private int first_x;
    private int first_y;
    private SkillMainPanel5 skillMainPanel = new SkillMainPanel5();

    public static SkillMainFrame5 getSkillMainFrame() {
        return (SkillMainFrame5) FormsManagement.getInternalForm(688).getFrame();
    }

    public SkillMainFrame5() {
        this.add(this.skillMainPanel);
        this.setBorder(BorderFactory.createEmptyBorder());
        ((BasicInternalFrameUI) this.getUI()).setNorthPane(null);
        this.setBounds(100, 100, 901, 548);
        this.setBackground(UIUtils.Color_BACK);
        this.setOpaque(false);
        this.setVisible(false);
        this.pack();
        this.addMouseMotionListener(new MouseMotionListener() {
            @Override
            public void mouseMoved(MouseEvent e) {
            }

            @Override
            public void mouseDragged(MouseEvent e) {
                if (SkillMainFrame5.this.isVisible()) {
                    int x = e.getX() - SkillMainFrame5.this.first_x;
                    int y = e.getY() - SkillMainFrame5.this.first_y;
                    SkillMainFrame5.this.setBounds(x + SkillMainFrame5.this.getX(), y + SkillMainFrame5.this.getY(), SkillMainFrame5.this.getWidth(), SkillMainFrame5.this.getHeight());
                }

            }
        });
        this.addMouseListener(this);
    }

    @Override
    public void mouseClicked(MouseEvent e) {
    }

    @Override
    public void mousePressed(MouseEvent e) {
        Music.addyinxiao("关闭窗口.mp3");
        if (e.isMetaDown()) {
            FormsManagement.disposeForm(688);
        } else {
            FormsManagement.Switchinglevel(688);
        }

        this.first_x = e.getX();
        this.first_y = e.getY();
    }

    @Override
    public void mouseReleased(MouseEvent e) {
    }

    @Override
    public void mouseEntered(MouseEvent e) {
    }

    @Override
    public void mouseExited(MouseEvent e) {
    }

    public SkillMainPanel5 getSkillMainPanel() {
        return this.skillMainPanel;
    }

    public void setSkillMainPanel(SkillMainPanel5 skillMainPanel) {
        this.skillMainPanel = skillMainPanel;
    }
}
